﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="PackageSetup.aspx.cs" Inherits="VSM.PackageSetup" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function openMultiItemDialog() {
            var tabid = '<%= Request.QueryString["requestType"] %> ';
            javascript: Main.openCustomDialog('../../ItemPopup.aspx?ItemCategory=' + '102', 600, 610, "");
            //window.location.href= 'PartOrder.aspx';
        }

        function openCustomer() {
            var url = "Popup_Customer.aspx?CustomerCode=" + document.getElementById('hf_CustomerCode').value;
            Main.openCustomDialog(url, 650, 470);
        }

        function openVehicle() {
            var url = "Popup_Vehice.aspx?VehicleCode=S";
            Main.openCustomDialog(url, 650, 470);
        }

        function disablePopup(sender, evt) {

            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (charCode == 13)
                return true;

            return true;
        }

        function loadQuotationReport() {
            var url = "rptQuotation.aspx?QuotationCode=S";
            Main.openCustomDialog(url, 650, 410);
        }

        function openPartOrder() {
            var url = "WarrantyService.aspx";
            Main.openCustomDialog(url, 650, 410);
        }

        function openDialog(type) {
            var url = "rptViewer.aspx?type=" + type + "&GeneralID=" + document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 700);
        }

        function openQuotation() {
            var url = "P_Quotation.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 700);
        }

        function openLabourCharge() {
            var url = "Popup_LabourCharge.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 700);
        }

        function openReceptionSheet() {
            var url = "Popup_ReceptionSheet.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 350);
        }
        function openQuickInspection() {
            var url = "QuickInspection.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 700);
        }

        function openRepairOrder() {
            var url = "P_JobCard.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 700);
        }

        function openPartOrder() {
            var url = "P_PartOrder.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 700);
        }

        function openRpt() {
            var url = "rptViewer.aspx?type=RE";
            Main.openCustomDialog(url, 950, 700);
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hf_GeneralID" runat="server" ClientIDMode="Static" />
                <h2>
                    &nbsp;Package Setting Up</h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%">
                        <tr>
                            <td style="width: 50%">
                                <table border="0" width="100%" style="background-color: #D1D4D8;">
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Model
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:DropDownList ID="ddl_Model" runat="server" Width="170px">
                                            </asp:DropDownList>
                                            <asp:Button ID="btn_NewModel" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                                Height="30px" Text="New Model" Width="90px" />
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            &nbsp;
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Package
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:DropDownList ID="ddl_Package" runat="server" Width="170px">
                                            </asp:DropDownList>
                                            <asp:Button ID="btn_NewPackage" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                                Height="30px" Text="New Package" Width="90px" />
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            &nbsp;
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table border="0" width="100%" style="background-color: #D1D4D8;">
                        <tr>
                            <td class="FormLineItem">
                                <asp:Button ID="btn_Load" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" Text="Load" Width="90px" OnClick="btn_Load_Click" />
                                <asp:Button ID="btn_Save" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" OnClick="btn_Save_Click" Text="Save" Width="90px" />
                            </td>
                            <td class="FormLineItem">
                                &nbsp;
                            </td>
                            <td class="FormLineItem">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem">
                            </td>
                            <td class="FormLineItem">
                                &nbsp;
                            </td>
                            <td class="FormLineItem">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" class="FormLineItem">
                                <asp:Button ID="btn_AddMultiItems" Text="Add Part" BackColor="#1B7FC2" runat="server"
                                    ForeColor="#FFFFFF" Height="30px" Width="90px" OnClick="btn_AddMultiItems_Click" />
                            </td>
                        </tr>
                    </table>
                    <div style="width: 100%">
                        <table border="0" width="100%" style="background-color: #D1D4D8;">
                            <asp:GridView ID="grvPO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                                BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                                HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" HeaderStyle-VerticalAlign="Middle"
                                AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" PageSize="20"
                                OnRowDataBound="grvSearchResult_RowDataBound">
                                <PagerSettings Mode="NumericFirstLast" />
                                <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                                <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                                <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                                <Columns>
                                    <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                        Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                        ItemStyle-Width="70px" />
                                    <asp:TemplateField HeaderText="Action">
                                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" OnClick="lnkDelete_Click"></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="#">
                                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_No" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                            </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="#">
                                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_PacDetID" runat="server" Text='<%# Bind("PacDetID") %>' BorderStyle="none">
                                            </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                     <asp:TemplateField HeaderText="#">
                                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_ModelCode" runat="server" Text='<%# Bind("ModelCode") %>' BorderStyle="none">
                                            </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                     <asp:TemplateField HeaderText="#">
                                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_PackageID" runat="server" Text='<%# Bind("PackageID") %>' BorderStyle="none">
                                            </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Part NBR">
                                        <ItemStyle HorizontalAlign="Left" Width="100px" />
                                        <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                        <ItemTemplate>
                                            <asp:TextBox ID="txt_ItemCode" runat="server" Text='<%# Bind("ItemCode") %>' OnTextChanged="TextBox_Change" AutoPostBack="true" ></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Part Name">
                                        <ItemStyle HorizontalAlign="Left" Width="250px" />
                                        <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_ItemName" runat="server" Text='<%# Bind("ItemName") %>' BorderStyle="none" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="VN Name">
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemStyle HorizontalAlign="Left" Width="250px" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbl_FrgnName" runat="server" Text='<%# Bind("FrgnName") %>' BorderStyle="none" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Quantity">
                                        <HeaderStyle VerticalAlign="Middle" />
                                        <ItemStyle HorizontalAlign="Right" Width="50px" />
                                        <ItemTemplate>
                                            <asp:TextBox ID="txt_Qty" runat="server" Width="97%" Text='<%# String.Format("{0,-15:#,##0.00}", Eval("Quantity")) %>'
                                                AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                    Height="27px" VerticalAlign="Bottom" />
                            </asp:GridView>
                        </table>
                    </div>
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td>
                            <table style="width: 100%">
                                <tr>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="true" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                <%-- <asp:PostBackTrigger ControlID="btn_ImportExcel" />--%>
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
